package org.testis.orm.refinedclasses;

import org.orm.PersistentException;

/**
 * 
 * @author Cahit Emir Erel
 */
public abstract class DesignPart implements Comparable {

    /**
     * Constructs and empty DesignPart
     */
    public DesignPart() {

    }

    /**
     * Returns Design Part id from Database reference
     * 
     * @return Design Part id from Database reference
     * @throws NullPointerException
     */
    public Integer getId() {
	return getReference().getId();
    }

    /**
     * Returns Design Part name
     * 
     * @return Design Part name
     * @throws NullPointerException
     */
    public String getName() {
	return getReference().getName();
    }

    /**
     * Deletes the Database reference
     * 
     * @return true if delete operation is successful
     * @throws NullPointerException
     */
    public boolean delete() {
	return getReference().deleteAndDissociate();
    }

    public abstract DesignPart createRefinedDatabaseCopy()
	    throws PersistentException;

    public abstract Identifier getReference();

    public abstract String getTypeName();

    public abstract String toString(TestDesignTreeNode treeNode);
}
